import request from '@/utils/request'

// 获取轮播图列表
export function getCarousels() {
  return request({
    url: '/carousels',
    method: 'get'
  })
}

// 添加轮播图
export function createCarousel(data) {
  return request({
    url: '/carousels',
    method: 'post',
    data
  })
}

// 更新轮播图
export function updateCarousel(id, data) {
  return request({
    url: `/carousels/${id}`,
    method: 'put',
    data
  })
}

// 删除轮播图
export function deleteCarousel(id) {
  return request({
    url: `/carousels/${id}`,
    method: 'delete'
  })
}

// 更新轮播图排序
export function updateCarouselSort(data) {
  return request({
    url: '/carousels/sort',
    method: 'put',
    data
  })
}

// 上传轮播图
export function uploadCarouselImage(data) {
  return request({
    url: '/upload/carousel',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data
  })
} 